package cate.common.table.mall.row;

import cate.common.table.ERow;
import cate.common.table.XSSFRowWrap;
import cate.common.util.random.RWItem;
import easy.java.dev.note.NoteClass;
import easy.java.dev.note.NoteField;

@NoteClass(value = "商城商品表")
public class MallItemsRow extends ERow implements RWItem {
    @NoteField(value = "商品名")
    public String name;

    @NoteField(value = "商品内容")
    public String itemConfig;

    @NoteField(value = "类型", detail = "0:普通 1:初始作弊商品 2:在特定条件下加入卡池")
    public byte type;

    @NoteField(value = "商店ID")
    public int mallId;

    @NoteField(value = "资源消耗")
    public String consumeConfig;

    @NoteField(value = "折扣")
    public int dicount;

    @NoteField(value = "限购次数")
    public int limitNum;

    @NoteField(value = "VIP等级")
    public int vipRequired;

    @NoteField(value = "主角等级下限")
    public Integer levelMin;

    @NoteField(value = "主角等级上限")
    public Integer levelMax;

    @NoteField(value = "开服天数")
    public int openDay;

    @NoteField(value = "限购重置周期")
    public String autoCycle;

    @NoteField(value = "分组")
    public int group;

    @NoteField(value = "权重")
    public double weight;

    @NoteField(value = "缚灵之塔通关条件")
    public String towerConditionStr;

    @NoteField(value= "无尽试炼关数")
    public int endlessCondition;

    @NoteField(value = "主线冒险关数")
    public int adventureCondition;

    @Override
    public void parse(XSSFRowWrap xr) {
        this.id = xr.getInteger("id", 0);
        this.name = xr.getString("商品名称");
        this.type = xr.getByte("类型", (byte) 0);
        this.itemConfig = xr.getString("商品内容");
        this.mallId = xr.getInteger("商店ID", -1);
        this.consumeConfig = xr.getString("资源消耗");
        this.dicount = xr.getInteger("折扣", -1);
        this.limitNum = xr.getInteger("限购次数", -1);
        this.vipRequired = xr.getInteger("VIP等级", 0);
        this.levelMin = xr.getInteger("主角等级下限");
        this.levelMax = xr.getInteger("主角等级上限");
        this.openDay = xr.getInteger("开服天数", 0);
        this.autoCycle = xr.getString("限购重置周期");
        this.group = xr.getInteger("分组", 0);
        this.weight = xr.getDouble("权重", 100.0);
        this.towerConditionStr = xr.getString("缚灵之塔层数");
        this.endlessCondition = xr.getInteger("无尽试炼关数", 0);
        this.adventureCondition = xr.getInteger("主线冒险关数", 0);
    }

    @Override
    public double getWeight() {
        return weight;
    }
}
